<template>
    <div >
        <div class="all_info_left">
            <div class="user_info_box">
                <USER_BASIC_INFO :user="userstore.get_user()"/>
            </div>
            <div class="text_interract_info">
                <TEXT_INTERRACT_INFO/>
            </div>

            <div class="text_list_info"> 
                <TEXT_INFO_LIST  
                @load_more="mytext_load_more" @cell-click="text_list_info_click" 
                :rows="text_list"
                :headers="text_headers"
                />
            </div>
        </div>
       <div class="all_info_right">
            <div class="platform_info">
                <PLATFORM_INFO/>
            </div>

       </div>
      
    </div>
</template>

<script setup>
import TEXT_INFO_LIST from "@/components/common/list2.vue"
import USER_BASIC_INFO from "@/components/community/delivery/right/index/user_basic_info.vue"
import TEXT_INTERRACT_INFO from "@/components/community/delivery/right/index/text_interract_info.vue"
import PLATFORM_INFO from "@/components/community/delivery/right/index/platform_info.vue"
import { inject, onMounted, ref, watch } from "vue"
import { customDivision } from "@/static/js/number/division.js"
import { get_text_by_user  } from "@/api/community/main.js"
import { success } from "@/static/js/alert"
import { noreapeat_array_byId } from "@/static/js/array/concat_two_norepeat"
const userstore = inject('user')()
let text_list = ref([])
const text_headers=ref(["标题","日期","点赞数","阅读量","收藏数"])
// 文本数量更新
const mytext_load_more = async (value) => { 
    const pre_data = await get_text_by_user(userstore.value.get_user().id, customDivision(value, 10))
    const newdata = noreapeat_array_byId(text_list.value, pre_data, 'uuid')
    text_list.value=newdata
}
watch(text_list, (new_value, old_value) => { 
    if (new_value.length === old_value.length) {
        success("没有更多了")
    }
})



const text_list_info_click = function (dom, header, row) { 
    console.log(dom, header, row)

}
onMounted(async () => {
    const data = await get_text_by_user(userstore.value.get_user().id, 1)
    text_list.value=data
   
    // console.log(userstore.value.get_user())
})



</script>

<style  scoped>
.all_info_left{
    vertical-align: top;
    display: inline-block;
    width: 800px;
    height: 100%;
}
.user_info_box{
    display: inline-block;
    width: 100%;
    height: 150px;
    /* background-color: black; */
    border-radius: 8px;
    border: 1px solid #dcdee2;
}
.text_interract_info{
   margin-top: 10px;
   width: 100%;
   border: 1px solid #dcdee2;
   height: 130px;
   border-radius: 8px;
}
.text_list_info{
    margin-top: 10px;
    width: 100%;
    height: auto;
    min-height: 200px;
    border: 1px solid #dcdee2;
    border-radius: 8px;
}





.all_info_right{
    vertical-align: top;
    margin-left: 80px;
    display: inline-block;
    width: 350px;
    height: 100%;
}
.platform_info{
    display: inline-block;
    width: 100%;
    height: 40px;
    line-height: 40px;
    padding-left: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 8px;
    border: 1px solid #dcdee2;
}
.platform_interatc_info{
    width: 100%;
    margin-top: 45px;
    height: 180px;
    border-radius: 8px;
    border: 1px solid #dcdee2
}
.hot_topic_info{
    margin-top: 45px;
    width: 100%;
    min-height: 200px;
    border-radius: 8px;
    border: 1px solid #dcdee2
}


</style>